<template>
	<view>
		<view class="w100 express_wrap">
			<view class="w100 mb20 order_box">
				<view class="w100 order p10">
					<view class="fl">
						<text>物流公司</text>
					</view>
					<view class="fl ml30">
						<text class="red_text">{{ option.express_name }}</text>
					</view>
				</view>

				<view class="w100 order p10">
					<view class="fl">
						<text>物流单号</text>
					</view>
					<view class="fl ml30">
						<text class="red_text">{{ option.express_no }}</text>
						<view class="act-copy fr" @click="COMMON.value_copy(option.express_no)">
							<text>复制</text>
						</view>
					</view>
				</view>
			</view>

			<view>
				<view class="w100 mb20 order_box" v-if="!data.status">
					<view class="logis-detail">
						{{ data.msg || data.data }}
					</view>
				</view>
				<view class="w100 mb20 order_box" v-else>
					<view class="logis-detail">
						<view class="logis-item" :class="{ first: index === 0 }" v-for="(item, index) in data.data"
							:key="index">
							<view class="logis-item-content">
								<view class="logis-item-content__describe">
									<text class="f-26">{{ item.context }}</text>
								</view>
								<view class="logis-item-content__time">
									<text class="f-22">{{ item.ftime }}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app';
	import {
		COMMON
	} from "@/utils/commom.js"
	import {
		query_express
	} from "@/api/order.js"

	const option = ref({});
	const data = ref([]);

	onLoad((options) => {
		option.value = options
	})

	onShow(() => {
		get_express(
			option.value.express_no,
			option.value.code,
			option.value.phone
		)
	})

	// 获取物流详情
	function get_express(express_no, code, phone) {
		query_express({
			express_no,
			code,
			phone
		}).then(res => {
			data.value = res
		})
	}
</script>

<style lang="scss" scoped>
	@import '@/static/css/order.scss';

	.express_wrap {
		padding: 30rpx;
	}
</style>